package com.googlecode.animator.view.materialslibrary
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.filesystem.File;
	import flash.net.FileFilter;
	
	import mx.controls.Button;

	public class MaterialsFLVButtonMediator extends MaterialsButtonMediator
	{
		/**
		 * Identifier. 
		 */
		public static const NAME:String = "MaterialsFLVButtonMediator";
		
		/**
		 * Constructor. 
		 * @param viewComponent
		 * 
		 */
		public function MaterialsFLVButtonMediator(viewComponent:Button)
		{
			super(NAME, viewComponent);
		}
		
		/**
		 * Responds to a user clicking on the button used to load materials. 
		 * @param evt
		 * 
		 */
		override protected function onLoadButtonClick(evt:MouseEvent):void
		{
			super.onLoadButtonClick(evt);
			
			var ff:FileFilter = new FileFilter("Media .flv", "*.flv;");
			
			if(_file == null)
			{
				_file = File.documentsDirectory;
			}
				
			_file.addEventListener(Event.SELECT, onFileSelect);
			_file.browseForOpen("Open",[ff]);
			
		}
		
	}
}